package sgd.tp2.server.cmdline;

import sgd.tp2.api.cmdline.CEPTypeConverter;
import sgd.tp2.api.cmdline.PacketSizeConverter;
import sgd.tp2.api.cmdline.CDRFormatConverter;
import sgd.tp2.api.cmdline.MetricsFileConverter;
import sgd.tp2.api.cmdline.NetProtocolPortConverter;
import sgd.tp2.api.cmdline.NetProtocolTypeConverter;
import sgd.tp2.api.net.CDRFormatType;
import sgd.tp2.api.net.CEPType;
import sgd.tp2.api.net.NetProtocolType;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;

@Parameters(separators = "=")
public class ConfigurationOptions {

	@Parameter(names = {"-protocol", "-t"}, converter = NetProtocolTypeConverter.class, description = "Protocolo de transporte usado. Estao disponiveis apenas TCP e UDP")
	public NetProtocolType protocol = NetProtocolType.TCP;

	@Parameter(names = {"-port", "-p"}, converter = NetProtocolPortConverter.class, description = "Porta onde o servidor, seja TCP ou UDP, e' aberto")
	public int port = 1234;

	@Parameter(names = {"-format", "-f"}, converter = CDRFormatConverter.class, description = "Formato de dados recebidos. Estao disponiveis os formatos XML, JSON, CSV, Object ou Bytes")
	public CDRFormatType format = CDRFormatType.XML;

	@Parameter(names = {"-metricsfile", "-m"}, converter = MetricsFileConverter.class, description = "Ficheiro para onde as metricas sao escritas. Se nao for especificado vao para o ecra")
	public String loggingFile = null;
	
	@Parameter(names = {"-packetSize", "-s"}, converter = PacketSizeConverter.class, description = "Tamanho do buffer de leitura, no caso de uso do protocolo UDP")
	public int packetSize = 1024;
	
	@Parameter(names= {"-cep", "-c"}, converter = CEPTypeConverter.class, description = "Escolhe o engine CEP a usar (ESPER ou STREAMBASE) ou NONE para nao usar nenhum")
	public CEPType cep = CEPType.NONE;
}
